package com.css.zfzx.fwsjcj.modules.group.service.impl;

import com.css.zfzx.fwsjcj.modules.group.entity.FwGroupUserEntity;
import com.css.zfzx.fwsjcj.modules.group.repository.FwGroupUserRepositoty;
import com.css.zfzx.fwsjcj.modules.group.service.FwGroupUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FwGroupUserServiceImpl implements FwGroupUserService {
    @Autowired
    FwGroupUserRepositoty fwGroupUserRepositoty;
    @Override
    public void saveGroupIdAndUserId(List<FwGroupUserEntity> list) {
        fwGroupUserRepositoty.saveAll(list);
    }

    @Override
    public void deletGroupIdAndUserId(List<FwGroupUserEntity> list) {
        fwGroupUserRepositoty.deleteAll(list);
    }

    @Override
    public List<FwGroupUserEntity> findByGroupId(String id) {
        List<FwGroupUserEntity> allByGroupId = fwGroupUserRepositoty.findAllByGroupId(id);
        return allByGroupId;
    }

    @Override
    public List<FwGroupUserEntity> findByUserId(String userId) {
        List<FwGroupUserEntity> allByGroupId = fwGroupUserRepositoty.findAllByUserId(userId);
        return allByGroupId;
    }

}
